﻿using System;
using ThePresenter.Net.NetCom;
using ThePresenter.Net.PresenterCom.Uids;
using System.Runtime.Serialization;

namespace ThePresenter.Net.PresenterCom.Actions
{
	[Serializable]
	class ServerIntroductionAction : PresenterAction, ISerializable
	{
		public Guid Guid;
		public String Name;

		public ServerIntroductionAction(Guid guid, String name)
		{
			this.Guid = guid;
			this.Name = name;
		}

		#region ISerializable Members

		public ServerIntroductionAction(SerializationInfo info, StreamingContext ctxt)
		{
			this.Guid = (Guid)info.GetValue("Guid", typeof(Guid));
			this.Name = (String)info.GetValue("Name", typeof(String));
		}

		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if ((Guid == Guid.Empty) || (Name == String.Empty))
				throw new MissingFieldException();

			info.AddValue("Guid", Guid);
			info.AddValue("Name", Name);
		}

		#endregion
	}
}
